/**
 * 产品修改js
 */
var comValidform=null;
var returnStatus=false;
var agreementAdd={
	agreementUE:null,
		
	startEvent:function(){
		$("#recordTab ul").idTabs();
		 
		agreementAdd.agreementUE = UE.getEditor('agreement',{
			initialFrameHeight:340,
			initialFrameWidth:898
		});
		
		comValidform=$(".com-addForm").Validform({
			datatype:{
				"m0-2" : /^[0-9]+(.[0-9]{1,2})?$/
			},
			tiptype:2,
			tipSweep:true,
		
			beforeSubmit:function(curform){
				var url = 'mgr/agreementCtrl/save';
				var params = jsUtils.serializeJson($('.com-addForm'));
				 
				
				var agreement = agreementAdd.agreementUE.getContent();
				params.agreement = agreement;
				params.creater = userId;
				
				var cb = function(data){

					//成功返回
					if(data.resultCode==200){
						alert("已保存，如上传了新图片文件，请联系技术部处理才能在APP中正常显示！");
						//关闭窗口并刷新数据
						returnStatus=true;
					}else{
						alert(data.msg);
					}
				};
				sendApiNoLoadSync(url, params, cb, 'POST');
				return returnStatus;
			}
		});
	},
	
	init:function(){
		agreementAdd.startEvent();
	}
}
$(document).ready(function() {
	agreementAdd.init();
});
function submitForm(){
	comValidform.submitForm();
	return returnStatus;
}